<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>展示页面</title>
    <link rel="stylesheet" href="../../res/layuis/dist/css/layui.css"  media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
    <script src="../../res/layuis/dist/layui.all.js" charset="utf-8"></script>
    <!--<script src="../../res/layuis/dist/layui.js" charset="utf-8"></script>-->
    <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
    <script src="../../res/js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
        *{margin:0;padding:0;}

        #div1{
            float: left;
            width: 10%;
            visibility: hidden;
            border: solid 1px #0C0C0C;
        }

        #div2{
            float: left;
            width: 5%;
            visibility: hidden;
            border: solid 1px #0C0C0C;
        }

        #div3{
            float: left;
            width: 90%;
            border: solid 0px #0C0C0C;
        }

        #informContent{
            float: left;
            width: 80%;
            border: solid 1px #0C0C0C;

        }

        #bottomContent{
            float:left;
            width: 100%;
            text-align: left;
            border: solid 0px #0C0C0C;

        }

        #headline{
            float: left;
            width: 100%;
            text-align: center;
            font-size: 2.5em;
            border: solid 0px #0C0C0C;


        }


        #content{
            float:left;
            width: 100%;
            text-align: left;
            border: solid 0px #0C0C0C;

        }

        #publisher{
            float: left;
            width: 100%;
            font-size: 1.5em;
            text-align: right;
            border: solid 0px #0C0C0C;
        }

        #creator{
            float: left;
            width: 100%;
            font-size: 1.5em;
            text-align: right;
            border: solid 0px #0C0C0C;
        }

        #datePosted{
            float: left;
            width: 100%;
            font-size: 1.5em;
            text-align: right;
            border: solid 0px #0C0C0C;
        }

        #annotation{
            float: left;
            width: 100%;
            font-size: 1.5em;
            text-align: left;
            border: solid 0px #0C0C0C;
        }

        #adjunct{
            float: left;
            width: 100%;
            font-size: 1.5em;
            text-align: left;
            border: solid 0px #0C0C0C;
        }

        #attachContent{
            border-style: none;
        }

        #attachId{
            display: none;
        }


    </style>

</head>

<body>
<div id="div1"></div>
<div id="informContent">
        <div id="attachId" ></div>
        <div id="headline" >
            <p>&nbsp;</p>
            <p><span id="attachName">标题</span></p>
            <p>&nbsp;</p>
            <hr style="width: 100%; align-self: center; background-color: #0d8ddb; height: 5px">
        </div>

        <div id="bottomContent">
            <div id="div2"></div>
            <div id="div3">
                <div id="content">
                    <!--        <textarea id="attachContent" class="layui-text">-->
                    <!--            内容-->
                    <!--        </textarea>textarea-->
                    <iframe id="attachContent"
                            name="ifd"
                            onload="this.height=ifd.document.body.scrollHeight"
                            width="100%" scrolling="no"
                            frameborder="0">
                    </iframe>
                </div>
                <div style="float: right">
                    <p>&nbsp;</p>
                </div>
                <div id="publisher">
                    <p><span >发布人：</span></p>
                    <p>&nbsp;<span id="attachPublisher" style="font-size: 0.8em"></span></p>
                </div>
                <div style="float: right">
                    <p>&nbsp;</p>
                </div>
                <div id="datePosted">
                    <p><span >发布日期：</span></p>
                    <p>&nbsp;<span id="attachTime" style="font-size: 0.8em"></span></p>
                </div>
                <div id="annotation">
                    <p>&nbsp;</p>
                    <p><span >注释：</span></p>
                    <p>&nbsp;&nbsp;&nbsp;&nbsp;<span id="remark" style="font-size: 0.8em"></span></p>
                </div>
                <div id="adjunct">
                    <p><br></p>
                    <p><span>附件下载：</span></p>
                    <table frame=void >
                        <tbody id="attachFile"></tbody>
                    </table>
                    <p align="right"><a class="layui-btn layui-btn-xs layui-btn-danger" onclick="doPrint()">打印此页</a></p>
                    <p><br></p>
                </div>
            </div>
        </div>

    </div>

<script>

    function doPrint() {
        window.print();
    }
    function beginShow(){
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit;
        var url = "../../attachment/selectByPrimaryKey";
        var attachId = $("#attachId").val();
        console.log("=============="+attachId);
        var data = {
            attachId : attachId
        };
        $.post(url,data,function (obj) {
            $("#attachName").text(obj.data.attachName);
            $("#attachPublisher").text(obj.data.attachPublisher);
            $("#attachTime").text(obj.data.attachTime);
            $("#remark").text(obj.data.remark);

            var attachContent = obj.data.attachContent+'<p><br></p>';
            $("#attachContent").attr("srcdoc",attachContent);

            var attachFile = "";
            var demoListView = $('#attachFile');
            if (obj.fileMessage != null){
                $.each(obj.fileMessage,function (index,dom) {
                    attachFile = $(['<tr id="upload-'+ index +'">'
                        ,'<td>'
                        ,'<a href="../../'+dom.fileSite+'" download>'
                        ,'<span style="font-size: 0.8em">&nbsp; &nbsp;'+ dom.fileName +'</span>'
                        ,'</a>'
                        ,'</td>'
                        ,'</tr>'].join(''));
                    demoListView.append(attachFile);
                });

            }

        });


    }



</script>

</body>
</html>